<?php
// Gestion theme special
// Pour qu un theme soit valide il doit y avoir la presence de 3 fichier
// - header.tpl
// - footer.tpl
// - design.tpl
// si l un des 3 fichier est manquant utilisation design origine
if($setting['theme'] != "")
{
	if(is_file(IMMOPHP_ROOT_PATH . 'theme/'. $setting['theme'] .'/header.tpl') && is_file(IMMOPHP_ROOT_PATH . 'theme/'. $setting['theme'] .'/footer.tpl') && is_file( IMMOPHP_ROOT_PATH . 'theme/'. $setting['theme'] .'/design.css'))
	{
		$fichier_theme_header = IMMOPHP_ROOT_PATH . 'theme/'. $setting['theme'] .'/header.tpl';
		$fichier_theme_footer = IMMOPHP_ROOT_PATH . 'theme/'. $setting['theme'] .'/footer.tpl';
		$fichier_theme_css = 'theme/'. $setting['theme'] .'/design.css';
	} 
	else
	{
		$fichier_theme_header = IMMOPHP_ROOT_PATH . 'design/header.tpl';
		$fichier_theme_css = 'design/design.css';
		$fichier_theme_footer = IMMOPHP_ROOT_PATH . 'design/footer.tpl';
	}
}
else
{
	$fichier_theme_header = IMMOPHP_ROOT_PATH . 'design/header.tpl';
	$fichier_theme_css =  'design/design.css';
	$fichier_theme_footer = IMMOPHP_ROOT_PATH . 'design/footer.tpl';	
}
$header['js'] = '';
$header['css'] = '';
$header['js'] .='<script src="'. $config['url'] .'kernel/js/prototype.js" type="text/javascript"></script>'."\n";
$header['js'] .='<script src="'. $config['url'] .'kernel/js/scriptaculous.js?load=effects,builder" type="text/javascript"></script>'."\n";
$header['js'] .='<script src="'. $config['url'] .'kernel/js/lightbox.js" type="text/javascript"></script>'."\n";
$header['css'] .='<link rel="stylesheet" href="'. $config['url'] .''. $fichier_theme_css .'" type="text/css" media="screen" />'."\n";
$header['css'] .='<link rel="stylesheet" href="'. $config['url'] .'kernel/css/lightbox.css" type="text/css" media="screen" />'."\n";

$smarty->assign('setting', $setting);
$smarty->assign('header', $header);

/*
$template->set_filenames(array('header' => $fichier_theme_header));
$template->assign_vars(array(
'V_CSS'	=>	$Cssheader,
'V_JS'	=>	$Jsheader,
'V_DESCRIPTION_SITE'	=>	$setting['description_site'],
'V_KEYWORDS'	=>	$setting['keywords'],
'V_GOOGLE_IDENTIFIANT_SITE'	=>	$setting['google_identifiant_site'],
));*/
?>